package com.wskj.tencent.service.impl;

import com.wskj.common.utils.tencent.bean.VodApiRequest;
import com.wskj.system.domain.SysCommon;
import com.wskj.system.service.ISysCommonService;
import com.wskj.tencent.service.ITencentService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.*;

/**
 * redis的过期键信息Service业务层处理
 *
 * @author wsdz
 * @date 2022-09-29
 */
@Service
@AllArgsConstructor
public class TencentServiceImpl implements ITencentService {

    private final ISysCommonService iSysCommonService;

    @Override
    public List<String> getImConfig() {
        List<String> list = new ArrayList<>();
        // 即时通讯sdkAppId
        SysCommon one = iSysCommonService.getById(1000056L);
        list.add(one.getCommonValue());
        // 即时通讯imKey
        SysCommon two = iSysCommonService.getById(1000057L);
        list.add(two.getCommonValue());
        // 即时通讯管理员identifier
        SysCommon three = iSysCommonService.getById(1000058L);
        list.add(three.getCommonValue());
        return list;
    }

    @Override
    public void vodCallback(VodApiRequest vodApiRequest) {
        // 301-云端录制录制模块启动 302-云端录制录制模块退出 311-云端录制 VOD 录制任务上传媒体资源完成 312-云端录制 VOD 录制任务结束
        // 视频上传完成
        if (vodApiRequest != null && vodApiRequest.getEventGroupId() == 3 && vodApiRequest.getEventType() == 311) {
            // 任务ID
            String taskId = vodApiRequest.getEventInfo().getTaskId();
            // 录制视频地址
            String fileUrl = vodApiRequest.getEventInfo().getPayload().getTencentVod().getVideoUrl();
        }
    }
}
